package day05;
import java.util.Arrays;
public class MaxOfArray {
    public static void main(String[] args) {
        int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100 + 1);//填充数据
            System.out.print(arr[i]+"\t");//输出数据
        }
        System.out.println("");//换行

        Arrays.sort(arr);//对arr的升序排列，java中无自带降序方法
        System.out.println("升序后：");
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+"\t");
        }
        System.out.println("");//换行

        System.out.println("降序后：");
        for (int i = arr.length-1; i >=0; i--) {
            System.out.print(arr[i]+"\t");
        }

        /**int[] arr1 = {1, 2, 3, 4, 5};
        int max = arr1[0];
        for (int i = 1; i < arr1.length; i++) {
            if (arr1[i] > arr1[0]) {
                max = arr1[i];
            }
            System.out.println(max);
        }

        int min = arr1[0];
        for (int j = 1; j < arr1.length; j++) {
            if (arr1[j] < arr1[0]) {
                max = arr1[j];
            }
        }
        System.out.println(min);*/
    }

}